import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
            int count=0;
            int maxCount=0;
            int n=sc.nextInt();
            while(n!=0) {
                if ((n & 1) == 1) {
                    count++;
                    maxCount = Math.max(maxCount, count);
                } else {
                    count = 0;
                }
                n>>=1;
            }
            System.out.println(maxCount);

    }
}
